#ifndef DBMODEL_H
#define DBMODEL_H

#include <QAbstractTableModel>
#include <string>
#include <array>

#include "sqlite3.h"
#include "item.h"

class DbModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    DbModel(QObject *parent);
    ~DbModel();
public:
    int rowCount(const QModelIndex &parent = QModelIndex()) const ;
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    int query();
private:
    sqlite3 *db = NULL;
    Item *list = NULL;
    int size;
};

#endif // DBMODEL_H
